﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.ServiceModel.Activation;
using StripeOne.Service.Model.User;
using StripeOne.Service.Model.Common;

namespace StripeOne.Service
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class StripeOneService : IStripeOneService
    {
        public User Login(string username, string password)
        {
            //TODO: Fazer chamada ao banco e validar informações
            var status = Status.OK;
            var messages = new List<Message>();
            var message = new Message()
                        {
                            ID = 1,
                            MessageContent = "Messagem 1",
                            Title = "Titulo Mensagem 1"
                        };
            messages.Add(message);
            message = new Message()
            {
                ID = 1,
                MessageContent = "Messagem 2",
                Title = "Titulo Mensagem 2"
            };
            messages.Add(message);

            if (status == Status.OK)
                return new User()
                {
                    Email = "user@domain.com",
                    IsActive = true,
                    IsLoggedIn = true,
                    LastLogin = DateTime.Now,
                    Messages = messages,
                    Name = "Leandro Barral (StripeOne)",
                    SessionKey = "asd132qwe321",
                    Status = status,
                    Username = "Username"
                };

            return null;
        }
    }
}
